const userMap = {
  admin: {
    roles: ['admin'],
    token: 'admin',
    introducition: 'this is admin',
    avatar: require('../../assets/avatar.png'),
    name: 'super admin'
  },
  user: {
    roles: ['editor'],
    token: 'editor',
    introduction: '我是编辑',
    avatar: require('../../assets/avatar.png'),
    name: 'Normal Editor'
  }
}
const logins  = {
  loginByUsername: config => {
    const { username } = JSON.parse(config.body)
    return userMap[username]
  },
  getUserInfo: config => {
    const { userToken } = JSON.parse(config.body)
    if (userMap[userToken]) {
      return userMap[userToken]
    } else {
      return false
    }
  }
}

export default logins
